#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/11/22 17:40
# @Author  : FuKai ZHANG
# @File    : conftest.py.py
# @Description :管理全局的driver
import pytest
from selenium import webdriver


@pytest.fixture(scope="session", autouse=True)  # session级别可以跨py文件调用，多个用例只需要调用一次fixture
def my_drivers():
    driver = webdriver.Chrome()
    driver.maximize_window()
    yield driver
    driver.quit()

# @pytest.fixture(scope='session', autouse=True)
# def drivers():
#     global driver
#     options = webdriver.ChromeOptions()
#     # 无头模式
#     options.add_argument('--headless')
#     # 沙盒模式运行
#     options.add_argument('--no-sandbox')
#     # 大量渲染时候写入/tmp而非/dev/shm
#     options.add_argument('disable-dev-shm-usage')
#
#     driver = webdriver.Chrome(options=options)
#
#     yield driver
#     driver.quit()
